class Animal {
  name: string
  age?: number
  constructor(name: string = "旺财", age: number = 10) {
    this.name = name
    this.age = age
  }
  say(): void {
    console.log(`我是:${this.name},今年:${this.age}岁了`)
  }
}
class Cat extends Animal { }

let c: Cat = new Cat("小橘", 20)
c.say()

/* 继承扩展 */
class Person {
  name: string
  constructor(name: string) {
    this.name = name
  }

  say(): void {
    console.log(this.name)
  }
}

class Student extends Person {
  age: number
  constructor(name: string, age: number) {
    super(name)
    this.age = age
  }

  say(): void {
    // 调用父类的方法
    super.say()
    console.log("会覆盖父类的方法了")
  }
}

let s: Student = new Student("小明", 20)
s.say()

export {

}